<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="lib :: common_header"></head>
<body>
<div th:replace="lib :: header_box"></div>
<div th:replace="lib :: menu_box (3)"></div>

<div class="main-box" v-model="project_asset">
    <div class="main-container">
        <!-- 面包屑导航 -->
        <div class="row main-container-header">
            <div class="col-md-12 rel">
                <div class="main-container-header-line fix">
                    <div class="row">
                        <div class="col-xs-6 col-md-6"> <h4 class="g4"> <a class="a-back" href="javascript:history.go(-1)"><em class="el-icon-arrow-left"></em>
                            <em th:text="项目数据集"></em>
                        </a></h4></div>
                        <div class="col-xs-6 col-md-6 tr f12">
                            <div class="bread-link-box">
                                当前位置：<a th:href="@{/console/project}">项目管理</a>
                                &nbsp;&gt;&nbsp;
                                <em th:text="项目数据集"></em>
                            </div><!-- /bread-link-box -->
                        </div>
                    </div><!-- /row -->
                </div><!-- main-container-header-line -->
            </div>
        </div><!-- /main-container-header -->

        <div class="f14" id="app" v-cloak>
            <br>
            <el-card shadow="hover" class="rel">
                <p> 项目名称：<span class="red b">{{ project.name }}</span> </p>
                <p> 项目类型：{{ project.type | changeProjectType }} <el-divider direction="vertical"></el-divider> 当前状态：{{ project.status | changeProjectStatus }} </p>
                <p style="margin-bottom:0;"> 创建日期：{{ project.createdate }} <el-divider direction="vertical"></el-divider> 概要说明：{{ project.rcontext }} </p>
                <img class="abs" th:src="@{/images/sa5.jpg}" height="100" style="right:0; top:8px;">
            </el-card><!-- /row -->

            <br>
            <el-card shadow="hover" class="rel">
                <table class="m_srchList">
                    <tbody id="search-result">
                    <tr style="border:0;">
                        <td class="imgtd" width="50">
                            <el-checkbox @change="checkAll"
                                        v-model="allCheck"></el-checkbox>
                        </td>
                        <td colspan="3">
                            <!--
                            <el-button type="primary" @click ="proAssetHanldeAdd">增加项目数据集</el-button>
                            -->
                            <el-button type="danger" @click ="proAssetHanldeDel">删除项目数据集</el-button>
                        </td>
                    </tr>
                    <tr v-for="(item, index) in proAssetData">
                        <td class="imgtd" width="50">
                            <el-checkbox v-model="proAssetMultipleSelect[index]"
                                         :checked="item.hehe"
                                         :true-label="item.id"
                                         :false-label="false">
                            </el-checkbox>
                        </td>
                        <td class="f12">
                            <p>
                                <span class="b f14"> {{ item.name }} </span>
                            </p>
                            <p class="m-t-xs">
                                文件名：<a class="text-primary">{{ item.file_name }}</a>
                            </p>
                            <p>
                                <template v-if="item.file_size > 1000 * 1000">
                                    文件大小：{{ Math.round(item.file_size / 1024 / 1024 * 100) / 100 }}G
                                </template>
                                <template v-else>
                                    文件大小：{{ Math.round(item.file_size / 1024 * 100) / 100 }}M
                                </template>
                            </p>
                        </td>
                        <td class="f12">
                            <div class="search-tags pt10 pb10">
                                <span class="ntag text-primary">状态{{ item.status | changeAssetStatus }}</span>
                                <span class="ntag text-primary">{{ item.type | changeAssetType }}</span>
                                <span class="ntag text-primary">{{ item.lifecycle | changeAssetLifeCycle }}</span>
                            </div>
                            <p class="m-t-xs">
                                用途： {{ item.purpose }}
                            </p>
                            <p class="m-t-xs">
                                上传时间：{{ item.createdate }}
                            </p>
                            <p class="m-t-xs">
                                摘要：{{ item.abstract }}
                            </p>
                        </td>
                        <td width="120" class="tc" style="text-align:center;">
                            <el-popover
                                    placement="bottom"
                                    width="240"
                                    trigger="click">
                                <div class="f12">
                                    <p>  申请人：{{ item.applicant_id }} </p>
                                    <p>  申请时间：{{ item.appdate }} </p>
                                    <p>  平台审批时间：{{ item.cv_approval_date }} </p>
                                    <p>  平台审批结果：<span class="red">{{ item.cv_approval_result | cvApprovalResult }}</span> </p>
                                    <p>  所有者审批时间：
                                        <template v-if="item.associator_approval_date">{{ item.associator_approval_date }}</template>
                                        <template v-else>-</template>
                                    </p>
                                    <p style="margin-bottom:0;">
                                        所有者审批结果：
                                        <template v-if="item.associator_approval_result">
                                            <span class="red">{{ item.associator_approval_result | cvApprovalResult }}</span>
                                        </template>
                                        <template v-else>
                                            请等待
                                        </template>
                                    </p>
                                </div>
                                <el-button slot="reference" type="mini">查看审批结果</el-button>
                            </el-popover>

                        </td>
                    </tr>
                    </tbody>
                </table>

                <div class="block mt20 tr">
                    <el-pagination
                        mini
                        layout="sizes, prev, pager, next"
                        :page-sizes="[10, 20, 50, 100]"
                        :page-size="proAssetPageSize"
                        :total="proAssetDataFromDB.length"
                        @current-change="handleProAssetPageChange"
                        @size-change="handleProAssetPageSizeChange">
                    </el-pagination>
                </div>
            </el-card><!-- /row -->

            <!--增加数据集-->
            <el-dialog
                    title="数据集列表"
                    :visible.sync="dialogVisible"
                    width="80%">
                <div class="row">
                    <el-form :rules="assetRules" label-width="70px" inline="true">
                        <el-form-item label="名称" prop="name">
                            <el-input v-model="assetName"></el-input>
                        </el-form-item>
                        <el-form-item label="类型" prop="type">
                            <el-select v-model="assetType" clearable placeholder="请选择">
                                <el-option
                                        v-for="item in assetTypes"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="所属会员" prop="org">
                            <el-select v-model="orgId" clearable placeholder="请选择">
                                <el-option
                                        v-for="item in orgData"
                                        :key="item.id"
                                        :label="item.name"
                                        :value="item.id">
                                </el-option>                                </el-option>
                            </el-select>
                        </el-form-item><br>
                        <el-form-item label="用途" prop="purpose">
                            <el-input v-model="assetPurpose"></el-input>
                        </el-form-item>
                        <el-form-item label="摘要" prop="abstract">
                            <el-input v-model="assetAbstract"></el-input>
                        </el-form-item>
                        <el-form-item label="数据集ID" prop="id">
                            <el-input v-model="assetId"></el-input>
                        </el-form-item><br>
                        <el-form-item label="注册时间">
                            <el-date-picker
                                    v-model="assetDate"
                                    type="datetimerange"
                                    format="yyyy 年 MM 月 dd 日"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    :default-time="['00:00:00', '23:59:59']"
                                    @change="setTime"
                                    range-separator="至"
                                    start-placeholder="开始时间"
                                    end-placeholder="结束时间">
                            </el-date-picker>
                        </el-form-item>

                        <el-form-item>
                            <el-button type="default" @click="browseAssetHanldeByMultipleItem(assetCurrentPageNo)">查询</el-button>
                        </el-form-item>
                    </el-form>
                    <div style="margin-top: 20px">
                        <button class="btn btn-primary" @click="addAssetToProject()">确 认</button>
                        <button class="btn btn-info" @click="assettoggleSelection()">取消选择</button>
                        <button class="btn btn-default" @click="goback">返 回</button>
                    </div>
                </div><!-- /row -->
                <div class="row">
                    <div class="col-sm-12">
                        <div class="mt10">
                            <template>
                                <el-table
                                        ref="assetTable"
                                        highlight-current-row
                                        :data="assetData"
                                        border
                                        style="width: 100%"
                                        @selection-change="handleSelectionAssetChange">
                                    <el-table-column
                                            type="selection"
                                            width="55">
                                    </el-table-column>
                                    <el-table-column
                                            prop="name"
                                            label="名称"
                                            width="250">
                                    </el-table-column>
                                    <el-table-column
                                            prop="file_name"
                                            label="文件名"
                                            width="250">
                                    </el-table-column>
                                    <el-table-column
                                            prop="file_size"
                                            label="大小"
                                            width="250">
                                    </el-table-column>
                                    <el-table-column
                                            prop="type"
                                            label="类型"
                                            width="80">
                                        <template slot-scope="scope">
                                            {{ scope.row.type | changeAssetType }}
                                        </template>
                                    </el-table-column>
                                    <el-table-column
                                            prop="orgname"
                                            label="所属会员"
                                            width="250">
                                    </el-table-column>
                                    <el-table-column
                                            prop="purpose"
                                            label="用途"
                                            width="250">
                                    </el-table-column>
                                    <el-table-column
                                            prop="abstract"
                                            label="摘要"
                                            width="250">
                                    </el-table-column>
                                    <el-table-column
                                            prop="lifecycle"
                                            label="原生衍生"
                                            width="250">
                                        <template slot-scope="scope">
                                            {{ scope.row.lifecycle | changeAssetLifeCycle }}
                                        </template>
                                    </el-table-column>
                                    <el-table-column
                                            prop="status"
                                            label="状态"
                                            width="150">
                                        <template slot-scope="scope">
                                            {{ scope.row.status | changeAssetStatus }}
                                        </template>
                                    </el-table-column>
                                    <el-table-column
                                            prop="createdate"
                                            label="上传时间"
                                            width="150">
                                    </el-table-column>
                                </el-table>
                            </template>
                            <div class="block mt10 tr">
                                <el-pagination
                                        small
                                        layout="prev, pager, next, sizes, total, jumper"
                                        :page-sizes="[1,5, 8, 10, 15, 20, 25, 30]"
                                        :page-size="assetPageSize"
                                        :total="assetDataFromDB.length"
                                        @current-change="handleAssetPageChange"
                                        @size-change="handleAssetPageSizeChange">
                                </el-pagination>
                            </div>
                        </div>
                    </div><!-- /col -->
                </div><!-- /row -->
            </el-dialog>


        </div><!-- /app -->
    </div>
</div>
<div th:replace="lib :: javascript_box"></div>
<script> var id = '[[${id}]]'; </script>
<script th:src="@{/lib/console/project_asset.js}"></script>
</body>
</html>

